using System.Collections.Generic;

public class Table_AnimationItem : IDataItem
{
	/// <summary>
	/// 唯一ID
	/// <summary>
	public int Id { get; private set; }
	/// <summary>
	/// 动画名称
	/// <summary>
	public string AinmName { get; private set; }
	/// <summary>
	/// 优先级
	/// <summary>
	public int Layer { get; private set; }
	/// <summary>
	/// 播放模式1(1一次 2循环)
	/// <summary>
	public int WrapMode { get; private set; }
	/// <summary>
	/// 播放模式2
	/// <summary>
	public int PlayMode { get; private set; }
	/// <summary>
	/// 播放模式3
	/// <summary>
	public int QueueMode { get; private set; }
	/// <summary>
	/// 速度
	/// <summary>
	public int Speed { get; private set; }
	/// <summary>
	/// 过渡时间
	/// <summary>
	public int TransitTime { get; private set; }
	/// <summary>
	/// 循环次数
	/// <summary>
	public int LoopTime { get; private set; }
	/// <summary>
	/// 循环结束动作
	/// <summary>
	public int LoopOverAnimId { get; private set; }
	/// <summary>
	/// 是否能被打断
	/// <summary>
	public bool IsCanBreak { get; private set; }
	/// <summary>
	/// 结束后是否回调
	/// <summary>
	public bool IsCallEnd { get; private set; }
	/// <summary>
	/// 结束后的下一动作
	/// <summary>
	public int NextAnimId { get; private set; }
	/// <summary>
	/// 动作音效
	/// <summary>
	public int SoundId { get; private set; }

	public Table_AnimationItem(ExcelLineReader reader)
	{
		Id = reader.ReadInt();
		AinmName = reader.ReadString();
		Layer = reader.ReadInt();
		WrapMode = reader.ReadInt();
		PlayMode = reader.ReadInt();
		QueueMode = reader.ReadInt();
		Speed = reader.ReadInt();
		TransitTime = reader.ReadInt();
		LoopTime = reader.ReadInt();
		LoopOverAnimId = reader.ReadInt();
		IsCanBreak = reader.ReadBool();
		IsCallEnd = reader.ReadBool();
		NextAnimId = reader.ReadInt();
		SoundId = reader.ReadInt();
	}
}

public class Table_AnimationMgr : IDataMgr
{
	protected override string FileName { get { return "Txt/Animation.txt"; } }

	protected Dictionary<int, int> mItemDic = new Dictionary<int, int>();
	public int GetIdxById(int key) { return mItemDic[key]; }

	public override void Load(ExcelLineReader reader)
	{
		var item = new Table_AnimationItem(reader);
		mItemDic[item.Id] = DataCount;
		mItemList.Add(item);
	}

	public Table_AnimationItem GetItemByIdx(int idx)
	{
		return GetItemByIdx<Table_AnimationItem>(idx);
	}

	public Table_AnimationItem GetItemById(int id)
	{
		int idx = GetIdxById(id);
		return GetItemByIdx(idx);
	}
}